package com.turtle.usercenter.users.controller;

import com.turtle.usercenter.users.entity.User;
import com.turtle.usercenter.users.service.IUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 用户信息
 *
 * @author turtle
 * @date： 2020-04-17
 */
@RestController
@Api(value = "用户信息" , tags = "用户信息")
@RequestMapping("/users/user")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))

public class UserController {

    private final IUserService userService;

    /**
     * 通过id获取用户信息
     *
     * @param id
     * @return User 用户
     */
    @ApiOperation("通过id获取用户信息")
    @GetMapping("/{id}")
    public User getUserById(@Validated @PathVariable Integer id) {
        return userService.getById(id);
    }

}